<?php

/**
 * Rubro form base class.
 *
 * @method Rubro getObject() Returns the current form's model object
 *
 * @package    MercaderDigital
 * @subpackage form
 * @author     Germán Figueredo
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseRubroForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'          => new sfWidgetFormInputHidden(),
      'Nombre'      => new sfWidgetFormInputText(),
      'Descripcion' => new sfWidgetFormInputText(),
      'PorcRecargo' => new sfWidgetFormInputText(),
      'Nivel'       => new sfWidgetFormInputText(),
      'ID_RubroSup' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('RubroSup'), 'add_empty' => false)),
      'fechaEvento' => new sfWidgetFormInputText(),
      'Evento'      => new sfWidgetFormInputText(),
      'id_user_ev'  => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('UsuarioEvento'), 'add_empty' => true)),
    ));

    $this->setValidators(array(
      'id'          => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'Nombre'      => new sfValidatorString(array('max_length' => 40)),
      'Descripcion' => new sfValidatorString(array('max_length' => 140)),
      'PorcRecargo' => new sfValidatorNumber(),
      'Nivel'       => new sfValidatorInteger(),
      'ID_RubroSup' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('RubroSup'))),
      'fechaEvento' => new sfValidatorPass(array('required' => false)),
      'Evento'      => new sfValidatorString(array('max_length' => 20, 'required' => false)),
      'id_user_ev'  => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('UsuarioEvento'), 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('rubro[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Rubro';
  }

}
